#!/bin/bash

sleep 0.1m

cd /data/docker/
chmod 777 -R /data/docker/elasticsearch
docker-compose -f docker-compose-elasticsearch.yml restart

sleep 1m

expect <<EOF
 set timeout 300
  spawn docker exec -it  elasticsearch  ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.9.0/elasticsearch-analysis-ik-8.9.0.zip
  expect "y/N"
  send "y\r"
EOF

cd /data/docker/
docker-compose -f docker-compose-elasticsearch.yml restart

